package com.yuanfeng.job.utils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolUtil {
    private final static int threads = 1;

    private static ExecutorService executorService = null;

    static {
        if(executorService == null){
            executorService = Executors.newFixedThreadPool(threads);
        }
    }

    public static void addTask(Thread thread){
        executorService.execute(thread);
    }

    public static void closeTask() throws Exception{
        executorService.shutdown();
    }
}
